# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kdav2
pkgver=0.3.0_git20200413 # Git version as latest release is old and doesn't compile
pkgrel=0
_commit="1bc569793f46dfe6dec33c69f0a78457e37ae15e"
pkgdesc="DAV protocol implementation with KJobs"
arch="all !armhf" # qtdeclarative
url="https://community.kde.org/KDE_PIM"
license="GPL-2.0-or-later"
depends_dev="qt5-qtbase-dev qt5-qtxmlpatterns-dev kcoreaddons-dev"
makedepends="$depends_dev extra-cmake-modules"
#source="https://download.kde.org/unstable/kdav2/$pkgver/src/kdav2-$pkgver.tar.xz"
source="https://invent.kde.org/pim/kdav2/-/archive/$_commit/kdav2-$_commit.tar.gz"
subpackages="$pkgname-dev"
builddir="$srcdir/$pkgname-$_commit"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# kdav2-davcollectionfetchjob and kdav2-davcollectioncreatejob require network access
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E "kdav2-davcollection(fetch|create)job"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="14d1257dc9fe322cac9d9c36593f36c25ed2fa9ea2a5d604d8cd7aa0e668a1c75bb6c20efe9c63e972dd8337be7c3c8206d9d1541cc378ba510a925c84de95e5  kdav2-1bc569793f46dfe6dec33c69f0a78457e37ae15e.tar.gz"
